const message = {
  state: {
    bookMsgTotal: 0,
    msgGetOrderNo: 0
  },
  mutations: {
    SET_TOTAL: (state, data) => {
      state[data.type] = data.total
    },
    REDUCE_TOTAL: (state, data) => {
      state[data.type] = state[data.type]-- ? state[data.type]-- : 0
    },
    SET_ORDER_NO: (state, data) => {
      state.msgGetOrderNo = data
    }
  },
  actions: {
    SetMsgTotal: ({ commit }, data) => {
      commit('SET_TOTAL', data)
    },
    ReduceMsgTotal: ({ commit }, data) => {
      commit('REDUCE_TOTAL', data)
    },
    SetMsgOrderNo: ({ commit }, data) => {
      commit('SET_ORDER_NO', data)
    }
  }
}

export default message
